#include <stdio.h>
#define N 40
int ReadScore(int score[])
{
    int i=-1;
    do{
        i++;
        printf("please input the score of No.%d student:",i+1);
        scanf("%d",&score[i]);
    }while(score[i]>=0);
    return i;
}
int Average(int score[],int n)
{
    int i,sum=0;
    double result;
    for(i=0;i<n;i++)
    {
        sum+=score[i];
    }
    result=(double)sum/n;
    return result;
}
void main()
{
    int score[N],n,i,counter=0;
    n=ReadScore(score);
    for(i=0;i<n;i++)
    {
        if(score[i]>Average(score,n))
        {
            counter++;
        }
    }
    printf("the average is %d\n",Average(score,n));
    printf("There are %d students whose scores are higher than the average.",counter);
}
